#include "config.h"
#include "../util.h"

map<string, string> Config::confMap;

void Config::load(fstream *conf){
	while(!conf->eof()){
		string line;
		getline(*conf, line);
		if(line.length() == 0 ||line[0] == '#')continue;
		vector<string> terms = util::tokenize(line, "=");
		set_val(terms[0], terms[1]);
	}
}

void Config::set_val(string name, string val){
	confMap.insert(pair<string, string>(name, val));
}

string Config::get(string key){
	return (*confMap.find(key)).second;
}